﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AssessmentTool.Services.DTO;
using AssessmentTool.PresentationLogic;
using ModelLayer;
using System.ComponentModel;
using AssessmentTool.Services;
using AssessmentTool;
using AssessmentTool.ServiceBridge;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace AdminApplication.ServiceBridge
{
    public class UtenteAdminServiceBridge
    {
        

        public static void getUserList(Utente utente, EventHandler<getSottopostiCompletedEventArgs> handler)
        {
            var proxy = UtenteServiceBridge.getProxy();
            proxy.getSottopostiCompleted += new EventHandler<getSottopostiCompletedEventArgs>(handler);
            proxy.getSottopostiAsync(utente);
        }
        public static void getUser(DTOUtente utente, EventHandler<getUtenteCompletedEventArgs> handler)
        {
            var proxy = UtenteServiceBridge.getProxy();
            proxy.getUtenteCompleted += new EventHandler<getUtenteCompletedEventArgs>(handler);
            proxy.getUtenteAsync(utente);
        }
        public static void valida(Sessione sessione, EventHandler<validaCompletedEventArgs> handler)
        {
            var proxy = UtenteServiceBridge.getProxy();
            proxy.validaCompleted += new EventHandler<validaCompletedEventArgs>(handler);
            proxy.validaAsync(sessione);
        }
        public static void inserisciUtente(Utente utente,Utente superiore, EventHandler<AsyncCompletedEventArgs> handler)
        {
            var proxy = UtenteServiceBridge.getProxy();
            proxy.inserisciUtenteCompleted += new EventHandler<AsyncCompletedEventArgs>(handler);
            proxy.inserisciUtenteAsync(utente,superiore);
        }
        public static void getProfiliInfo(List<DTOUtente> utenti, EventHandler<getProfiliInfoFromUsersCompletedEventArgs> handler)
        {
            var proxy = UtenteServiceBridge.getProxy();
            proxy.getProfiliInfoFromUsersCompleted += new EventHandler<getProfiliInfoFromUsersCompletedEventArgs>(handler);
            proxy.getProfiliInfoFromUsersAsync( new ObservableCollection<DTOUtente>(utenti));
        }
        public static void getProfiliInfoExcel(List<DTOUtente> utenti, EventHandler<getProfiliUtentiExcelCompletedEventArgs> handler)
        {
            var proxy = ReportServiceBridge.getProxy();
            proxy.getProfiliUtentiExcelCompleted += new EventHandler<getProfiliUtentiExcelCompletedEventArgs>(handler);
            proxy.getProfiliUtentiExcelAsync(new ObservableCollection<DTOUtente>(utenti));
        }
        public static void importUtentiExcel(Utente utente,byte[] stream, EventHandler<importUtentiCompletedEventArgs> handler)
        {
            var proxy = ReportServiceBridge.getProxy();
            proxy.importUtentiCompleted+=new EventHandler<importUtentiCompletedEventArgs>(handler);
            proxy.importUtentiAsync(stream, utente);
        }
        public static void deleteUtente(List<DTOUtente> utenti, EventHandler<AsyncCompletedEventArgs> handler)
        {
            var proxy = UtenteServiceBridge.getProxy();
            proxy.deleteUtentiCompleted+=new EventHandler<AsyncCompletedEventArgs>(handler);
            ObservableCollection<DTOUtente> list = new ObservableCollection<DTOUtente>(utenti);
            proxy.deleteUtentiAsync(list);
        }
        
    }
}
